﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Mechanics.GameEventMechanics {
    import Mechanics.GameMechanicInterfaces.*;
    import Mechanics.*;
    import flash.utils.*;

    public class TieredDooberMechanic extends DooberMechanic {

        protected var m_tierTable:Array;

        public function TieredDooberMechanic(){
            this.m_tierTable = null;
        }
        override public function initialize(_arg1:IMechanicUser, _arg2:MechanicConfigData):void{
            var _local4:XML;
            super.initialize(_arg1, _arg2);
            this.m_tierTable = new Array();
            var _local3:XMLList = Global.gameSettings.getTierXml(m_config.params["tierTable"]);
            for each (_local4 in _local3.children()) {
                this.m_tierTable.push({
                    num:int(_local4.@num),
                    amount:String(_local4.@amount)
                });
            };
        }
        override public function getRandomModifiersName():String{
            return (Global.gameSettings.getTieredString(m_config.params["tierTable"], this.value));
        }
        protected function get value():Number{
            return (Number(m_owner.getDataForMechanic(m_config.type)));
        }
        public function getTierInfo(_arg1:int):Object{
            var _local2:Object;
            if (this.m_tierTable){
                _local2 = this.m_tierTable[_arg1];
            };
            return (_local2);
        }
        public function getNumTiers():int{
            var _local1:int;
            if (this.m_tierTable){
                _local1 = this.m_tierTable.length;
            };
            return (_local1);
        }
        public function getTierRewardInfo(_arg1:int):Dictionary{
            var tier:* = _arg1;
            var dict:* = null;
            var tierInfo:* = this.getTierInfo(tier);
            if (tierInfo){
                dict = Global.gameSettings.parseDisplayedStats(m_owner.getItemName(), m_config.rawXMLConfig.displayedStats.(@name == tierInfo.amount), tierInfo.amount);
            };
            return (dict);
        }

    }
}//package Mechanics.GameEventMechanics 
